﻿@model PhoneBilling.Models.Report1ResultModel
@{
    ViewBag.Title = "待收款统计";
    Layout = "~/Views/Shared/_Layout.cshtml"; 
}
<script type="text/javascript">
    $(document).ready(function () {
        $("#btnReturn").ligerButton(
        {
            click: function () {
                history.go(-1); //后退1页  
            }
        });
        $("#btnImport").ligerButton(
        {
            click: function () {
                $("form").submit();
            }
        });
    });
    
</script>
@using (Html.BeginForm("Report1","Statistics"))
{
    @Html.HiddenFor(m=>m.SelectItem)
    @Html.HiddenFor(m => m.收费等级)
    @Html.Hidden("IsExport",true)
    <input type="button" id="btnReturn" value="返回" />
    <input type="button" id="btnImport" value="导出Excel" />
}
@{
    System.Text.StringBuilder sb = new System.Text.StringBuilder();
    sb.AppendLine(string.Format("var data={{Total:{0},",Model.List.Count));
    sb.AppendLine("Rows:[");
    for(int i =0;i < Model.List.Count;i++)
    {
        var item = Model.List[i];
        if(i == 0)
        {
            sb.Append("{");
        }
        else
        {
            sb.Append(",{");
        }
        sb.Append(string.Format("部门:'{0}',", item.部门));
        sb.Append(string.Format("分组:'{0}',",item.分组));
        sb.Append(string.Format("分机号码:'{0}',",item.分机号码));
        sb.Append(string.Format("月份:'{0}',",item.月));
        sb.Append(string.Format("月租费:'{0}',",item.月租费));
        sb.Append(string.Format("功能费:'{0}',",item.功能费));
        sb.Append(string.Format("通话费:'{0}',",item.通话费));
        sb.Append(string.Format("话单总次数:'{0}',",item.话单总次数));
        sb.Append(string.Format("话单总金额:'{0}'",item.话单总金额));
        sb.Append("}");
    }
    sb.AppendLine("]};");
    string data = sb.ToString();
}
<script type="text/javascript">
    @Html.Raw(data)
    var grid;
    $(function () {

        grid = $("#maingrid").ligerGrid({
            columns: [
                { display: '部门', name: '部门',width:80},
                { display: '分组', name: '分组',width:80},
                { display: '分机号码', name: '分机号码',width:80},
                { display: '月份', name: '月份',width:80},
                { display: '月租费', name: '月租费',width:80},
                { display: '功能费', name: '功能费',width:80},
                { display: '通话费', name: '通话费',width:80},
                { display: '通话次数', name: '话单总次数',width:140,totalSummary:                    {render: function (suminf, column, cell){                            return '<div>总通话次数:' + suminf.max + '</div>';                        }}},
                { display: '总金额', name: '话单总金额',width:140,totalSummary:                    {render: function (suminf, column, cell){                            return '<div>总金额:' + suminf.max + '</div>';                        }}}],
                isScroll: false, data: data,pageSize:30,alternatingRow:true
        }
        );resetGridHeight(grid);
        $(window).resize(function () {
                resetGridHeight(grid);
            });
    });</script>
    <div id="maingrid"></div>
    @*<div>
        @{
    var grid = new WebGrid(source: Model.List, canPage: false);
        }
        @grid.GetHtml(
            alternatingRowStyle: "bg",
            columns: grid.Columns
            (
                  grid.Column("部门", "部门"),
                  grid.Column("分组", "分组"),
                  grid.Column("分机号码", "分机号码"),
                  grid.Column("月", "月份"),
                  grid.Column("月租费", "月租费"),
                  grid.Column("功能费", "功能费"),
                  grid.Column("通话费", "通话费"),
                   grid.Column("话单总次数", "通话次数"),
                  grid.Column("话单总金额", "总金额")
            )
        )
    </div>*@

